package com.yanchengtect.demo.progress.rollback.activity.dao;

import java.util.ArrayList;
import java.util.Date;
import java.util.List;

import org.springframework.stereotype.Repository;

import com.yanchengtect.demo.progress.dao.BaseDao;
import com.yanchengtect.demo.progress.rollback.activity.domain.Message;

/**
* @author 文心雕龙 Email：xuwenlong@shike8888.com
* @version 创建时间：2018年9月6日 下午6:22:39
* 类说明
*/
@Repository
public class MessageDao extends BaseDao<Message> {

	List<Message> listByParamsAndTime(String params,Date time){
		
		return null;
	}

	public int deleteByUidAndParams(Integer user_id, String proName) {
		
		StringBuffer sql = new StringBuffer( "delete from message where user_id=? and params like ? ");
		List<Object> args = new ArrayList<Object>();
		args.add(user_id);
		
		if (null != proName) {
//			sql.append("{\"pname\":\""+proName+"%");
			args.add("{\"pname\":\""+proName+"%");
			log.debug(sql.toString());
			return jdbcTemplate.update(sql.toString(), args.toArray());
		}else {
			return 0;
		}
	}
}
